<!-- 地图 -->
<template>
	<view class="">
		<view class="" v-if="kkms">
			<map :latitude="latitude" :longitude="longitude" :markers="covers" class="kkmxeret" :scale="scale" :polyline="polyline"> </map>

		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				id: 0, // 使用 marker点击事件 需要填写id
				title: 'map',
				latitude: '',
				longitude: '',
				scale:11,
				covers: [{ //气泡
					width:30,
					height:30,
					iconPath: 'https://duxinggj-2018-1251133427.cos.ap-guangzhou.myqcloud.com/2605605e-ab96-439e-9622-2a49a755dafd.png'
				}],
				polyline:[ // 画直线
					{
						points:[
							{latitude: 22.585485, longitude: 113.876467},
							{latitude:22.549026 , longitude:113.912945 },
							{latitude: 22.554257, longitude:113.982124 },
							{latitude:22.581047,  longitude: 113.954144}
						],
						width:6,
						arrowLine:true,
						color:"#009ef6"
					}
				],
				kkms: false
			}
		},
		components: {},
		methods: {},
		onLoad() {
			let th = this
			// 获取当前位置
			uni.getLocation({
				type: 'wgs84',
				success: function(res) {
					th.longitude = res.longitude
					th.latitude = res.latitude
					th.covers[0].longitude = res.longitude
					th.covers[0].latitude = res.latitude
					th.kkms = true
				}
			});
		},
		mounted() {}
	}
</script>
<style scoped>
	.kkmxeret {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
	}
</style>
